﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ext.Net;
using BO = Viewer.BusinessObject.BusinessEntities;

namespace Viewer.BaoCao.UserControls
{
    public partial class UcTinhHinhNghiHuu : System.Web.UI.UserControl
    {
        BusinessObject.BusinessEntities.NSNhanVien nhanvien = new Viewer.BusinessObject.BusinessEntities.NSNhanVien();
        protected void Page_Load(object sender, EventArgs e)
        {
            //wdTinhHinhNghiHuu.Reload();
        }

        
        [DirectMethod]
        public void ShowDialogTinhHinhNghiHuu(int nodeId)
        {
            string strTenToChuc = new BO.NSToChuc().GetByID(nodeId).TenToChucShort;
            wdTinhHinhNghiHuu.Title = "Tình hình nghỉ hưu - " + strTenToChuc;
            hdNodeIdToChuc.Text = nodeId.ToString();            
            txtMonth.Text = "6";
            int month = !string.IsNullOrEmpty(txtMonth.Text) ? Convert.ToInt32(txtMonth.Text) : 0;
            storeNhanVienNghiHuu.DataSource = nhanvien.ReturnMonthCount(Convert.ToInt32(hdNodeIdToChuc.Text), month);
            storeNhanVienNghiHuu.DataBind();
            wdTinhHinhNghiHuu.Show();
        }
        protected void BtnSearchNghiHuu_Click(object sender, DirectEventArgs e)
        {
            int month = !string.IsNullOrEmpty(txtMonth.Text) ? Convert.ToInt32(txtMonth.Text) : 0;
            storeNhanVienNghiHuu.DataSource = nhanvien.ReturnMonthCount(Convert.ToInt32(hdNodeIdToChuc.Text), month);
            storeNhanVienNghiHuu.DataBind();
            //string sMessage = "No records found. Please try again with different criterion.";
            X.Mask.Hide();
            
        }
    }

}